const path = require("path");
module.exports = {
  mode: "universal",
  rootDir: path.resolve(__dirname, "../"),
  srcDir: path.resolve(__dirname, "../client"),
  router: {
    middleware: "admin_login"
  },
  /*
   ** Headers of the page
   */
  head: {
    title: process.env.npm_package_name || "",
    meta: [
      { charset: "utf-8" },
      { name: "viewport", content: "width=device-width, initial-scale=1" },
      {
        hid: "keywords",
        name: "keywords",
        content: process.env.npm_package_description || ""
      },
      {
        hid: "description",
        name: "description",
        content: process.env.npm_package_description || ""
      }
    ],
    script: [
      { src: "/static/js/md5-min.js" },
      { src: "/static/js/baidu-tongji.js" }
    ],
    link: [{ rel: "icon", type: "image/x-icon", href: "/static/favicon.ico" }]
  },
  /*
   ** Customize the progress-bar color
   */
  loading: { color: "#dd1c1c" },
  /*
   ** Global CSS
   */
  css: [
    "element-ui/lib/theme-chalk/index.css",
    "@/assets/css/app.scss",
    "@/assets/css/admin.scss"
  ],
  /*
   ** Plugins to load before mounting the App
   */
  plugins: [
    "@/plugins/element-ui",
    "@/plugins/services",
    "@/plugins/axios",
    { src: "@/plugins/happy-scroll", mode: "client" },
    { src: "@/plugins/wang-editor", mode: "client" }
  ],
  /*
   ** Nuxt.js dev-modules
   */
  buildModules: [
    // Doc: https://github.com/nuxt-community/eslint-module
    // With options
    [
      "@nuxtjs/eslint-module",
      {
        fix: true
      }
    ]
  ],
  /*
   ** Nuxt.js modules
   */
  modules: ["cookie-universal-nuxt", "@nuxtjs/axios"],
  axios: {},
  /*
   ** Build configuration
   */
  build: {
    extractCSS: { allChunks: true },
    transpile: [/^element-ui/, /^vue-happy-scroll/, /^dayjs/],
    /*
     ** You can extend webpack config here
     */
    extend(config, ctx) {}
  }
};
